{% extends "tcms_base.html" %}
{% load static %}
{% block subtitle %}Clone Test Case{% endblock %}
{% block custom_stylesheet %}
{% endblock %}
{% block custom_javascript %}
<script type="text/javascript" src="{% static 'js/testcase_actions.js' %}"></script>
<script type="text/javascript">
Nitrate.Utils.after_page_load(Nitrate.TestCases.Clone.on_load);
</script>
{% endblock %}
{% block contents %}
<div id="content">
	<div id="hidden">
		<input id="value_plan_id" type="hidden" name="plan_id" value="{{ test_plan.plan_id }}" />
	</div>

	<h2>Clone TestCase(s)</h2>
	<div class="Detailform border-1">
		<div class="editor" cellspacing="0" cellspan="0">
			<div class="listinfo">
				<label class="strong title">Select Plan </label>
				{% if test_plan %}
				<div>
					<input type="radio" id="id_use_sameplan" name="selectplan" value="{{ test_plan.plan_id }}"/>
					<label for="id_use_sameplan" class="strong">Use the same Plan -- {{ test_plan.plan_id }} : {{ test_plan.name }}</label>
				</div>
				{% endif %}
				<div>
					<input type="radio" id="id_use_filterplan" checked="checked"  name="selectplan"/>
					<label for="id_use_filterplan" class="strong">Filter another plan</label>
					<div id="id_filterPlan">
					<form id="id_form_search_plan" action="{% url "plans-all" %}" method="get">
						<input type="hidden" name="action" value="clone_case" />
                                                <div class="cell">
                                                    <label class="sd" for="id_pk__in">ID</label>
                                                    {{ search_form.pk__in }}
                                                </div>
                                                <div class="cell">
                                                    <label class="sd" for="id_product_id">Product</label>
                                                    {{ search_form.product }}
                                                </div>
                                                <div class="cell">
                                                    <label class="sd" for="id_version_id">Product Version</label>
                                                    {{ search_form.product_version }}
                                                </div>
                                                <div class="cell">
                                                    <label class="sd" for="id_type_id">Plan Type</label>
                                                    {{ search_form.type }}
                                                </div>
                                                <div class="cell">
                                                    <label class="sd" for="id_author_id">Plan Author</label>
                                                    {{ search_form.author__email__startswith }}
                                                </div>
                                                <div class="cell">
                                                    <label class="sd" for="id_tag_id">Tag</label>
                                                    {{ search_form.tag__name__in }}
                                                </div>
                                                <div class="cell">
                                                    <label class="sd" for="id_name_id">Plan Summary</label>
                                                    {{ search_form.name__icontains }}
                                                </div>
                                                <div class="cell">
                                                    <label class="sd" for="id_is_active_id">Active</label>
                                                    {{ search_form.is_active }}
                                                </div>
						<div class="cell" style=" margin-left:0">
							<input type="submit" value="Filter plan" />
						</div>
					</form>
					</div>
				{% if submit_action %}
				{{ clone_form.plan.errors }}
				{% endif %}
				</div>
			</div>
			<form id="id_clone_form" action="{% url "testcases-clone" %}" method="post">
				{{ form.case_id }}
				<div class="listinfo">
					<label class="strong title"></label>
					<input id="id_plan_id" type="hidden" name="" value="" />
					<div id="id_plan_container" style="display: none;">
						<div class="ajax_loading"></div>
					</div>
				</div>
				<div class="listinfo">
					<label class="strong title">Case(s)</label>
					<div class="linotype">{{ clone_form.case }}</div>
				</div>
				<div class="listinfo">
					<label class="strong title">Clone Settings</label>
					<fieldset class="choose">
						<legend class="">Case Properties</legend>
						<ul class="ul-no-format">
							<li>
								{{ clone_form.copy_case }}
								<span>
									<label for="id_copy_case">{{ clone_form.copy_case.help_text }}</label>
								</span>
							</li>
							<li>
								{{ clone_form.maintain_case_orignal_author }}
								<span>
									<label for="orignal_author">{{ clone_form.maintain_case_orignal_author.help_text }}</label>
								</span>
							</li>
							<li>
								{{ clone_form.maintain_case_orignal_default_tester }}
								<span>
									<label for="id_maintain_case_orignal_default_tester">{{ clone_form.maintain_case_orignal_default_tester.help_text }}</label>
								</span>
							</li>
							<li>
								{{ clone_form.copy_component }}
								<span>
									<label for="id_copy_component">{{ clone_form.copy_component.help_text }}</label>
								</span>
							</li>
						</ul>
					</fieldset>
				</div>
				<div class="submit-row">
					<input type="hidden" name="from_plan" value="{{ test_plan.pk }}"/>
					<input type="submit" name="submit" value="Clone" />
					<input type="button" value="Cancel" class="js-cancel-button"/>
				</div>
			</form>
		</div>
	</div>
</div>
{% endblock %}
